<template>
  <Card style="height:900px">
    <p slot="title" style="color: red;font-size: large;">
      <Icon type="pinpoint"></Icon>
      快加查询
    </p>
    <!--查询成功日期（起）-查询成功日期（止）、客户姓名、身份证号码；-->
    <Row>
      <Form method="get" :rules="ruleInline" name="exportCreditExcel" id="exportCreditExcel" enctype="multipart/form-data">

        <DatePicker name="startCreatedDate" type="date" v-model="startCreatedDate" placeholder="查询成功日期(起)" style="width: 200px"></DatePicker>
        <DatePicker name="endCreatedDate" type="date" v-model="endCreatedDate" placeholder="查询成功日期(止)" style="width: 200px;margin-left: 10px;"></DatePicker>
        <Input name="custName" v-model="custName" style="width: 200px;margin-left: 10px;" placeholder="客户姓名"></Input>
        <Input name="custCardNo" v-model="custCardNo" style="width: 200px;margin-left: 10px;" placeholder="身份证号码"></Input>
        <Button type="primary" @click="queryPage">查询</Button>
        <Button type="warning" @click="exportCreditExcel" style="margin-left: 10px;">下载excel</Button>
      </form>
    </Row>

    <Table stripe border :columns="columns1" :data="data1" style="margin-top: 10px;"></Table>
    <div class="page-box">
      <Page :total="totalNumber" size="small" :current="currentPage" :page-size="pageSize" show-total @on-change="pageIndexChange"></Page>
    </div>
  </Card>
</template>

<script>
export default {
  data () {
    return {
      $ajax: null,

      path: this.$route.path,

      totalNumber: 0, // 总记录数

      currentPage: 1, // 当前页码

      pageSize: 20, // 页大小

      startCreatedDate: null,

      endCreatedDate: null,

      custName: '',

      custCardNo: '',

      // 序号、区域查询人姓名、查询人账号、查询人身份证号码、客户姓名、客户身份证号、编码、查询成功日期、是否回寄；
      columns1: [{
        type: 'index',
        width: 60,
        title: '序号'
      },
      {
        title: '区域查询人姓名',
        key: 'sname'

      },
      {
        title: '查询人账号',
        key: 'saccount'
      },
      {
        title: '查询人身份证号码',
        key: 'sidcard'
      },
      {
        title: '客户姓名',
        key: 'yname'
      },
      {
        title: '客户身份证号',
        key: 'yidcard'
      },
      {
        title: '编码',
        key: 'sqsbm'
      },
      {
        title: '查询成功日期',
        key: 'successDate'
      },
      {
        title: '是否回寄',
        key: 'yfreturn',
        render: (h, params) => {
          var yfreturn = params.row.yfreturn
          if (yfreturn === 0) {
            return h('div', [
              h('span', '否')
            ])
          } else {
            return h('div', [
              h('span', '是')
            ])
          }
        }
      }
      ],
      data1: [

      ]

    }
  },

  methods: {

    initPage () {
      this.queryPage()
    },

    queryPage () {
      var vm = this
      var params = {
        pageNum: vm.currentPage,
        pageSize: vm.pageSize,
        // custCardNo:'440883199408201939',
        // custName:'宁华勇'
        custName: vm.custName,
        custCardNo: vm.custCardNo,
        startCreatedDate: vm.startCreatedDate,
        endCreatedDate: vm.endCreatedDate
      }
      vm.$ajax.post(vm.$appContext.marvels_core_approve + '/approve/credit/report/service/quickList', params).then(re => {
        var data = re.data
        var code = data.code
        if (code === 'success') {
          // vm.data1 = data.
          vm.data1 = data.data.data
          vm.totalNumber = data.data.total
        }
      }).catch(er => {

      })
    },
    exportCreditExcel () {
      const vm = this
      document.getElementById('exportCreditExcel').action = vm.$appContext.marvels_core_approve + 'approve/credit/report/service/downloadacQuisitionExcel'
      document.getElementById('exportCreditExcel').submit()
    },
    pageIndexChange (pageIndex) {
      this.currentPage = pageIndex
      this.queryPage()
    }

  },

  created () {
    // 初始化当前页面请求对象实例
    this.$ajax = this.$util.ajax()
    this.initPage()
  }
}
</script>

<style lang="less">
@import '../../../styles/common.less';
@import '../../../styles/table.less';
</style>
